﻿using System.Collections.Generic;
using LAIR.ResourceAPIs.WordNet;
using System.IO;

namespace CBTM.IO
{
    public static class Constant
    {
        #region Constants

        // cơ sở dữ liệu WordNet 3.1
        public const string WNDatabase = "WNDB";

        // tài nguyên chương trình
        public const string MRDaPath = "Resources/EVDict_G.xml";
        public const string MRDbPath = "Resources/EVDict_G_old.xml";
        public const string MRDcPath = "Resources/EVDict_G_new.xml";
        public const string CoreWN = "Resources/core-wordnet.noun";
        public const string SW_En = "Resources/stopwords.en";
        public const string SW_Vi = "Resources/stopwords.vi";
        public const string SenseIndex = "Resources/index.sense";

        // các tập tin được tạo ra trong quá trình chạy chương trình
        public const string WNIndex = "Misc/wnindex.txt";
        public const string CCDic = "Misc/ccdic.txt";
        public const string CODic = "Misc/codic.txt";
        public const string BSTCheck = "Misc/bst-check.txt";

        // bảng
        public const string TTable1Path = "Tables/TTable1.xml";
        public const string TTable2Path = "Tables/TTable2.xml";
        public const string TTable3Path = "Tables/TTable3.xml";
        public const string SCTablePath = "Tables/SCTable.xml";
        public const string BSTTable1Path = "Tables/BSTTable1.xml";
        public const string BSTTable2Path = "Tables/BSTTable2.xml";
        public const string BSTTable3Path = "Tables/BSTTable3.xml";
        public const string VWNTablePath = "Tables/VWNTable.xml";

        // điều kiện dừng
        public const float Threshold = (float)0.001;
        public const int MaxLoop = 20;

        #endregion

        #region Variables

        public static WordNetEngine WNEngine;
        public static List<string> StopList;
        public static Dictionary<string, List<string[]>> TTable;
        public static Dictionary<string, string> SCTable;

        public static Dictionary<string, float> P_VEk;
        public static Dictionary<string, float> preP_VEk;
        public static Dictionary<string, Dictionary<string, float>> Pu;
        public static Dictionary<string, Dictionary<string, float>> Pb;

        public static Dictionary<string, float> Pu_UG;
        public static Dictionary<string, float> Pb_BG;

        public static Dictionary<string, float> P1_VEk;
        public static Dictionary<string, float> P1_Ek = new Dictionary<string, float>();

        #endregion

        #region Functions

        public static void Start()
        {
            WNEngine = new WordNetEngine(WNDatabase, true);
            StopList = Misc.LoadStopWords(SW_En);
            if (!Directory.Exists("Misc"))
                Directory.CreateDirectory("Misc");
            if (!Directory.Exists("Tables"))
                Directory.CreateDirectory("Tables");
        }

        #endregion
    }
}
